package com.example.shaidemo;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class HomeAdapter extends FragmentStateAdapter {
    public HomeAdapter(@NonNull Fragment fa) {
        super(fa);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        if(position==0){
            return new GongZiFragment();
        }else if(position==1){
            return new CarListFragment();
        }else{
            return new HotelListFragment();
        }
    }

    @Override
    public int getItemCount() {
        return 3;
    }
}

